import React from 'react'

class Test extends React.Component {
  render() {
    return <h2>test</h2>
  }
}

const Demo = React.forwardRef(function (props, ref) {
  console.log(props, ref)
  return <h2 ref={ref}>demo</h2>
})

const xxxRef = React.createRef()

export default function App() {
  return (
    <div>
      App
      <button
        onClick={() => {
          console.log(xxxRef.current)
        }}
      >
        按钮
      </button>
      <hr />
      {/* <Test ref={xxxRef}></Test> */}
      <Demo ref={xxxRef}></Demo>
    </div>
  )
}
